package com.sky.mapper;

import com.sky.entity.SetmealDish;
import com.sky.vo.DishItemVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealDishMapper {
    public void insert(List<SetmealDish> setmealDishes);

    @Select("select * from setmeal_dish where setmeal_id = #{setMealId}")
    List<SetmealDish> selectBySetMealId(Long setMealId);

    void deleteBySetMealId(List<Long> setMealIdList);

    Long selectIsExist(List<Long> dishIdList);

    @Select("select setmeal_id from setmeal_dish where dish_id = #{dishId}")
    Long getSetMealIdByDishId(Long dishId);

    @Select("select dish_id from setmeal_dish where setmeal_id = #{setMealId}")
    List<Long> getDishIdBySetMealId(Long setMealId);

    @Select("select t1.copies, t2.description, t1.name, t2.image from setmeal_dish t1, dish t2 where t1.dish_id = t2.id and t1.setmeal_id = #{setMealId}")
    List<DishItemVO> selectDishBySetMealId(Long setMealId);
}
